#include <stdio.h>
int susu(int m)
{
    int f;
    int i;
    f = 1;
    for (i = 2; i < m; i++)
        if (m % i == 0)
        {
            f = 0; break;

        }
    return f;
}
int yi(int z)
{
    int t = 0;
    if (z % 10 == 1)
        t = 1;
    return t;

}
int main()





{
    int n;
    int b;
    scanf_s("%d", &n);
    for (b = 2; b <= n; b++)
    {
        susu(b);
        yi(b);
        if (susu(b) == 1 && yi(b) == 1)
            printf("%d ", b);

    }


    return 0;
}
